package nacos

import (
	"sync"

	"github.com/nacos-group/nacos-sdk-go/model"
)

var defaultClient *client
var once = &sync.Once{}

func Init(nacosServer, nacosServiceName, nacosServiceGroup string) {
	once.Do(func() {
		defaultClient = newClient(nacosServer, nacosServiceName, nacosServiceGroup)
	})
}

func Register(up bool) {
	defaultClient.register(up)
}

func DeRegister() {
	defaultClient.deRegister()
}

func GetAllServices() (map[string]model.Service, error) {
	return defaultClient.getAllService()
}